home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 6686 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.2 KB  |  88 lines

  1. Path: tank.news.pipex.net!pipex!demon!le-vamp.demon.co.uk
  2. From: Kurt@le-vamp.demon.co.uk (Kurt Frary)
  3. Newsgroups: comp.lang.c++
  4. Subject: Can anyone explain ?
  5. Date: Fri, 09 Feb 1996 23:15:10 GMT
  6. Message-ID: <823907577.10880@le-vamp.demon.co.uk>
  7. Reply-To: kurt@le-vamp.demon.co.uk
  8. NNTP-Posting-Host: le-vamp.demon.co.uk
  9. X-NNTP-Posting-Host: le-vamp.demon.co.uk
  10. X-Newsreader: Forte Agent .99c/32.126
  11.  
  12.  I know this isn't neccessarily the correct group, but everyone here
  13. seems to be real coders.
  14.  
  15.  I can code, cobol, Assembler, (Amiga and PC fairly well), e.t.c
  16. e.t.c.
  17.  
  18.  
  19. Can someone shed some light on this piece of code, I have just started
  20. using Watcom C++ Dos4Gw, Flat model and all that
  21.  
  22. What I want to know is the following
  23.  
  24. A) can someone give me some decent comments for the code ?
  25.  
  26. B) What the difference between
  27.     Regs.w.ax - I have only a guess that this will load ax with
  28. whatever 32 bit code, or am I being a lamer ?
  29. and    Regs.h.bl - Load bl with whatever 16 bit ?
  30.  
  31. C) How do i know how many parameters to pass to int386x ? i.e. Sregs,
  32. regs e.t.c.
  33.  
  34.  
  35.  
  36. As you can see I have already worked out how to pass screen modes
  37. e.t.c. probably haven't got a clue though.....
  38.  
  39.  
  40. P.S. Thanks to everyone in the group for all the help I have had, I am
  41. already adding things to the F.A.Q about intergrating Watcom with
  42. Tasm.
  43.  
  44.  
  45. #include <i86.h>
  46. #include <dos.h>
  47. #include <stdio.h>
  48. #include <string.h>
  49.  
  50. static struct rminfo {
  51.     long EDI;
  52.     long ESI;
  53.     long EBP;
  54.     long reserved_by_system;
  55.     long EBX;
  56.     long EDX;
  57.     long ECX;
  58.     long EAX;
  59.     short flags;
  60.     short ES,DS,FS,GS,IP,CS,SP,SS;
  61. } RMI;
  62.  
  63. void scrmode(char scrmode)
  64. {
  65.     union REGS regs;
  66.     struct SREGS sregs;
  67.     int interrupt_no=0x31;
  68.  
  69.     /* Set up real-mode call structure */
  70.     memset(&RMI,0,sizeof(RMI));
  71.     
  72.     RMI.EAX=scrmode;  /* call service 00h ah=0x39 and pass in Al 13 or
  73. 0D  */
  74.  
  75.     /* Use DMPI call 300h to issue the DOS interrupt */
  76.     regs.w.ax = 0x0300;
  77.     regs.h.bl = 0x10;
  78.     sregs.es = FP_SEG(&RMI);
  79.     regs.x.edi = FP_OFF(&RMI);
  80.     int386x( interrupt_no, ®s, ®s, &sregs );
  81.  
  82. MM MM   A    SS K K   EEE  RR
  83. M M M  A A  S    K K  E    R R
  84. M   M  AAA   S   KK   EEE  RR
  85. M   M  A A    S  K K  E    R R
  86. M   M  A A  SS   K K  EEE  R R  :)
  87.  
  88.